<?php $this->renderPartial('_tabs'); ?>
<div class="grid_16">
    <div class="admin-agency form">
		<?php
		$form = $this->beginWidget('CActiveForm', array(
			'id' => 'admin-agency-commissions-form',
			'enableAjaxValidation' => false,
			'htmlOptions' => array()
				));
		?>
        <div class="section">
			<div class="block">
				<table class="form-table">
					<tr>
						<th scope="row" width="180">
							<label>Default Commission Date</label>
							<p class="hint">(The default date used for commission calculations)</p>
						</th>
						<td>
							<?php
							echo CHtml::dropDownList('AgencySetting[Commission][Policies][DefaultCommissionDate]', (in_array($agency->settings['Commission']['Policies']['DefaultCommissionDate'], Agency::getDefaultCommissionDateSettings()) ? $agency->settings['Commission']['Policies']['DefaultCommissionDate'] : "User specified Date"), Agency::getDefaultCommissionDateSettings());
							?>
						</td>
					</tr>
					<tr>
						<th scope="row" width="180">
							<label>Accumulated amount</label>
							<p class="hint">Amounts accumulated for commission calculations</p>
						</th>
						<td>
							<?php
							echo CHtml::dropDownList('AgencySetting[Commission][Policies][CumulativeAmountsForScore]', $agency->settings['Commission']['Policies']['CumulativeAmountsForScore'], array('Submitted' => 'Total Gross Commission Approved', 'Paid' => 'Total Gross Commission Received'), array('prompt' => ''));
							?>
						</td>
					</tr>
					<tr>
						<th scope="row" width="180">
							<label>Rounding Strategy</label>
							<p class="hint">How final computed amounts (for agents) are rounded</p>
						</th>
						<td>
							<?php
							echo CHtml::dropDownList('AgencySetting[Commission][Policies][RoundingStrategy]', $agency->settings['Commission']['Policies']['RoundingStrategy'], Math::getRoundingStrategies());
							?>
						</td>
					</tr>
					<tr>
						<th scope="row" width="180">
							<label>Rounding Precision</label>
							<p class="hint">How many decimal places to round off to (Default: 2)</p>
						</th>
						<td>
							<?php
							echo CHtml::textField('AgencySetting[Commission][Policies][RoundingPrecision]', $agency->settings['Commission']['Policies']['RoundingPrecision'], array('placeholder' => '2'));
							?>
						</td>
					</tr>
				</table>
				<table class="form-table">
					<th>
						<button type="submit" class="link-button round_all no-margin">
							<span>Save Changes</span>
						</button>
					</th>
				</table>
			</div>
        </div>
		<?php $this->endWidget(); ?>
    </div>
</div>